<?php
namespace App\Exports;

use App\Models\Booking;
use App\Models\BookingField;
use App\Models\Field;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;

class BookingExport implements FromView
{
    private $where;
    public function __construct($where)
    {
        $this->where = $where;
    }

    public function view(): View
    {
         
        $list   = Booking::where($this->where)
                            ->orderBy('created_at','desc')
                            ->get();            
        $fields = Field::where(['status'=>1])->get();
        return view('admin.booking.export_index', [
            'list'   => $list,
            'fields' => $fields
        ]);
    }
}

?>